package com.richard.prototype.demo01;

import javax.swing.*;
import java.util.Date;

/*
客户端：克隆
 */
public class Bililili {
    public static void main(String[] args) throws CloneNotSupportedException {
        //原型对象v1
        Date date = new Date();
        Video v1 = new Video("狂神说Java",date);
        Video v2 = (Video) v1.clone();

        System.out.println("v1=>" + v1);
        System.out.println("v2=>" + v2);

        System.out.println("=====================");

        date.setTime(112323324);
        System.out.println("v1=>" + v1);
        System.out.println("v2=>" + v2);

    }
}


/**
 *
 Date date = new Date();
 Video v1 = new Video("狂神说Java", date);
 System.out.println("v1=>" + v1);
 System.out.println("v1=>hash:" + v1.hashCode());


 //v1 克隆  v2
 //Video v2 = new Video("狂神说Java",date);

 Video v2 =(Video) v1.clone(); //克隆出来的对象和原来的是一模一样的
 System.out.println("v2=>" + v2);
 System.out.println("v2=>hash:" + v2.hashCode());
 */